package dao

import (
	"context"
	"test.com/project-user/internal/data/projectAuth"
	"test.com/project-user/internal/database"
	"test.com/project-user/internal/database/gorms"
)

type ProjectAuth struct {
	conn *gorms.GormConn
}

func (p *ProjectAuth) SaveProjectAuth(conn database.DbConn, ctx context.Context, pja *projectAuth.ProjectAuth) error {
	p.conn = conn.(*gorms.GormConn)
	tx := p.conn.Tx(ctx)
	err := tx.Save(pja).Error
	return err
}

func NewProjectAuth() *ProjectAuth {
	return &ProjectAuth{
		conn: gorms.New(),
	}
}
